#encoding:UTF-8
import re
import mylib
import pythonlibSB

def get_hot_link():
    
    try:
        results = []
        content = mylib.get_content('http://vietnamnet.vn/')
        
        hot_10_link = []
        hot_10_content = pythonlibSB.s_string(content,'class="top-hot-news-box-2"','div')
        for i in re.finditer('(<a)(.*?)(href=")(.*?)(")',hot_10_content):
            hot10link = i.group(4) if i.group(4).find('http://')!=-1\
                            else ('http://vietnamnet.vn'+i.group(4))
            hot_10_link.append(hot10link)
        results.append(hot_10_link)
        
        hot_9_link = []
        hot_9_content = pythonlibSB.s_string(content,'class="tab-item"','div')
#        print hot_9_content
        for j in re.finditer('(<a)(.*?)(href=")(.*?)(")',hot_9_content):
            hot9link = j.group(4) if j.group(4).find('http://')!=-1\
                        else ('http://vietnamnet.vn'+j.group(4))
            hot_9_link.append(hot9link)
        results.append(hot_9_link)
        
        main_content = pythonlibSB.s_string(content,'class="columnsPageLeft"','div')
        hot_8_link = []
       
        
        results.append(hot_8_link)
        results.append([])
        
        return results
    except:
        return []

if __name__ == "__main__":
    myres = get_hot_link()
    print myres